import React from 'react'
import { BrowserRouter, Route, Routes, Navigate, useRoutes } from 'react-router'

const Login = React.lazy(() => import('../pages/Login'))
const PetClass = React.lazy(() => import('../pages/PetClass'))
const Register = React.lazy(() => import('../pages/Register'))
const PetList = React.lazy(() => import('../pages/PetList'))
const Publish = React.lazy(() => import('../pages/Publish'))
const Message = React.lazy(() => import('../pages/Aixiaoxi'))


 
const routes = [
    {
        path: '/',
        element: <Navigate to="/petClass" />
    },
    {
        path: '/login',
        element: <Login />
    },{
        path: '/petClass',
        element: <PetClass />
    },{
        path: '/register',
        element: <Register />
    },{
        path: '/petList/:category',
        element: <PetList />
    },{
        path: '/publish',
        element: <Publish />
    },{
        path: '/message',
        element: <Message />
    }


]
function WrapperRoutes() {
    let ele = useRoutes(routes) //<Routes></Routes>
    return ele

}
export default function WrapperRouter() {
    return (
        <BrowserRouter>
            <WrapperRoutes />
        </BrowserRouter>

    )
}